package model;

import java.sql.Timestamp;

public class Question implements IEntity
{
	private int id;
	private String userPhone;
	private String userName;
	private int maxDistance;
	private String title;
	private String content;
	private Timestamp date;

	public Question()
	{
		id = 0;
		userPhone = null;
		userName = null;
		maxDistance = 1;
		title = null;
		content = null;
		date = null;

	}
	
	public Question(String userPhone)
	{
		this.userPhone = userPhone;
		
		id = 0;
		userName = null;
		maxDistance = 1;
		title = null;
		content = null;
		date = null;
	}


	public int getId()
	{
		return id;
	}

	public String getUserPhone()
	{
		return userPhone;
	}
	
	public String getUserName()
	{
		return userName;
	}

	public int getMaxDistance()
	{
		return maxDistance;
	}
	
	public String getTitle()
	{
		return title;
	}

	public String getContent()
	{
		return content;
	}

	public Timestamp getDate()
	{
		return date;
	}

	public String getDateString()
	{
		return date.toString();
	}

	public void setId(int id)
	{
		this.id = id;
	}
	
	public void setUserName(String userName)
	{
		this.userName=userName;
	}

	public void setUserPhone(String userPhone)
	{
		this.userPhone = userPhone;
	}

	public void setTitle(String title)
	{
		this.title = title;
	}

	public void setContent(String content)
	{
		this.content = content;
	}
	
	public String getDetailJsonString()
	{
		String[] names = {"id","title","userPhone","content","maxDistance","date"};
		String[] values={getId()+"",getTitle(),getUserPhone(),getContent(),getMaxDistance()+"",getDateString()};
		String jsonStr = JsonPack.convertToOneJsonStr(names, values, 6);
		System.out.println("getDetailJsonString:"+jsonStr);
		return jsonStr;
	}

}
